Skip to content

Add Intl.Segmenter support #539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 1, 2024
Merged

Add Intl.Segmenter support #539

merged 5 commits into from
Aug 1, 2024

Conversation

ExplodingCabbage
Copy link
Collaborator

@ExplodingCabbage ExplodingCabbage commented Aug 1, 2024

Resolves #438; probably also adequately resolves #214 even though it's not quite the solution that was asked for in that issue.

@ExplodingCabbage ExplodingCabbage marked this pull request as ready for review August 1, 2024 12:26
@ExplodingCabbage ExplodingCabbage merged commit 4f0430a into master Aug 1, 2024
@ExplodingCabbage ExplodingCabbage deleted the intl.segmenter branch August 1, 2024 12:30
ryota-ka added a commit to ryota-ka/DefinitelyTyped that referenced this pull request Oct 1, 2024
ryota-ka added a commit to ryota-ka/DefinitelyTyped that referenced this pull request Oct 8, 2024
ryota-ka added a commit to ryota-ka/DefinitelyTyped that referenced this pull request Oct 8, 2024
// 2. "Mei (梅) has (有) many (很多) sons (儿子)"
// We want to see that diffWords will get the word counts right and won't try to treat the
// trailing 子 as common to both texts (since it's part of a different word each time).
// TODO: Check with a Chinese speaker that this example is correct Chinese.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello, @ExplodingCabbage, I'm Chinese, I can confirm that the meaning of these two sentences are correct.

But I'm not sure about the test purpose here.

I can see that

> [...chineseSegmenter.segment('我有很多桌子。')].map(({segment})=>segment)
[ '我有', '很多', '桌子', '。' ]
> [...chineseSegmenter.segment('梅有很多儿子。')].map(({segment})=>segment)
[ '梅', '有', '很多', '儿子', '。' ]

Not sure why '我有' are together, but '梅', '有' are separated, if you want test something similar you can change 梅有 to 他有(He has) or 她有(She has).

Copy link
Contributor

@fisker fisker May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's quite strange...

> [...chineseSegmenter.segment('她有很多桌子。')].map(({segment})=>segment)
[ '她', '有', '很多', '桌子', '。' ]
> [...chineseSegmenter.segment('他有很多桌子。')].map(({segment})=>segment)
[ '他有', '很多', '桌子', '。' ]

'她' and '他' are the same, but one for male, one for female.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants